<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>功能菜单管理</title>
    <%@ include file="../../header_inc.jsp"%>
	<script type="text/javascript">
	//所有的子窗体都需要有一个save函数，当点击弹出窗体的保存按钮时所进行的操作
	function btnSave_click()
	{
	   var fun_ret = false;
	   var vals =$('#formModule').serialize();
	   var url = '${saveUrl}';
	   $.ajax({
	       async: false, 
	       type: "POST", 
	       url : url,
	       data:vals,
	       cache:false,
	       dataType : 'json', 
	       success : function(data) { 
	           if(data.success!=0)
	           {
	               top.Ext.Msg.alert("提示",data.msg);
	           }
	           else
	           {
	               fun_ret = true;
	           }
	       } 
	   });
	   return fun_ret;
	}
	
    function type_change()
    {
        var type = $('#type').val();
        if(type==1)
        {
            $('#url').attr("disabled",true);
            $('#pname').combobox('disable');
        }
        else
        {
        	$('#pname').combobox('clear');
        	showDataInCombotree('${ctx }/manage/sysMenus/getModule?type='+type,$("#pname"),'${model.parentId}');
        	$('#pname').combobox('enable');
            $('#url').removeAttr("disabled");
        }
    }
    $(document).ready(function(){
        type_change();
    });
	</script>
  </head>
  <body>
		<div style="padding:1px" align="center">
	    <form id="formModule" method="post">
	    	<input id="id" type="hidden" name="id" value="${model.id }">
	    	<!--  <input id="pid" type="hidden" name="parentId" value="${sysMenus.PARENT_ID }">-->
	    	<table border="0">
                <tr>
                    <td height="28">菜单类型：</td>
                    <td><select id="type" name="type" style="width:200px;height: 25px" onchange="type_change()">
                            <option value="1" <c:if test="${model.type==1}">selected</c:if>>菜单组</option>
                            <option value="2" <c:if test="${model.type==2}">selected</c:if>>菜单项</option>
                            <option value="3" <c:if test="${model.type==3}">selected</c:if>>菜单功能</option>
                        </select></td>
                </tr>
                
                 <tr>
                    <td height="28">上级菜单：</td>
                    <td><select id="pname" name="parentId" class="easyui-combotree"  style="width:200px;height:25px" data-options="editable:false">
						</select>
					</td>
                </tr>
                
	    		<tr>
	    			<td height="28">菜单名称：</td>
	    			<td><input id="name" class="easyui-validatebox textbox" type="text" name="name" data-options="required:true" style="width:200px;height: 25px" value="${model.name }"></input></td>
	    		</tr>
	    		<tr>
	    			<td height="28">链接地址：</td>
	    			<td><input id="url" class="textbox" type="text" name="url" style="width:200px;height: 25px" value="${model.url }"></input></td>
	    		</tr>
	    		<tr>
	    			<td height="28">显示顺序：</td>
	    			<td><input id="showOrder" onkeyup="value=value.replace(/[^1234567890-]+/g,'')" class="textbox" style="width:200px;height: 25px" type="text" name="showOrder"  value="${model.showOrder }"></input></td>
	    		</tr>
	    		<tr>
	    			<td height="28">显示图标：</td>
	    			<td><input id="img" class="textbox" style="width:200px;height: 25px" type="text" name="img" value="${model.img }"></input></td>
	    		</tr>
	    		<tr>
	    			<td height="28">状态：</td>
	    			<td><select id="status" name="status" style="width:200px;height: 25px" onchange="type_change()">
	    					<option value="9" <c:if test="${model.status==9}">selected</c:if>>启用</option>
	    					<option value="0" <c:if test="${model.status==1}">selected</c:if>>禁用</option>
	    				</select></td>
	    		</tr>
	    	</table>
	    </form>
	    </div>
  </body>
</html>
